import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router)
const index = () => import('../pages/index.vue')
const cate = () => import('../pages/cate.vue')
const cart = () => import('../pages/cart.vue')
const mine = () => import('../pages/mine.vue')
const layout = () => import('../components/layout.vue')
// const index = () => import('../pages/index.vue')

const router = new Router({
  // 路由模式
  mode: 'history',
  // 路由表
  routes: [
    {
      path: '',
      component: layout,
      children: [
        {path: 'index', component: index, meta: {title: '首页'}},
        {path: 'cate', component: cate, meta: {title: '分类'}},
        {path: 'cart', component: cart, meta: {title: '购物车'}},
        {path: 'mine', component: mine, meta: {title: '我的'}},
      ]
    }
  ]
})

// push的报错
// 导航守卫

export default router